home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir37 / mxmnu241.zip / UTILS.INC < prev    next >
Text File  |  1993-01-26  |  11KB  |  543 lines

  1. Comment
  2. ==========================================================
  3.  
  4. This include file contains a lot of useful utilities. It is
  5. smart enough to present the netware choices only if connected
  6. to a novell network.
  7.  
  8. =========================================================
  9. EndComment
  10.  
  11. ;----- Create Variables
  12.  
  13. Var
  14.   PrintQueueChoices
  15.   PortChoices
  16.   MyServer
  17.   AllUsers
  18.   NetAddress
  19.   Station
  20.   UserName
  21.   BMess
  22.   TitleBackColor
  23.   TitleInsideColor
  24.   PersonalMenu
  25.   FilePicked
  26.   NovCon
  27.  
  28.  
  29. ;=============[ Util Menu ]============*
  30.  
  31. :Util
  32.  
  33. if NetworkVersion then NovCon = NovConnection <> 0
  34.  
  35. ;----- Port Choices
  36.  
  37. Dispose(PortChoices)
  38.  
  39. AppendArray(PortChoices,'Lpt1')
  40. AppendArray(PortChoices,'Lpt2')
  41. AppendArray(PortChoices,'Lpt3')
  42.  
  43.  
  44. AddChoice('Format Disk Menu',1)
  45. AddChoice('Dos Functions',2)
  46. if NovCon
  47.    AddChoice('Printer Select',3)
  48.    AddChoice('Novell Information',4)
  49.    AddChoice('Novell User Options',5)
  50.    if NovConsoleOperator
  51.       AddChoice('Novell Utilities',6)
  52.       AddChoice('Maintainence',7)
  53.       AddChoice('Menu Utilities',8)
  54.       AddChoice('Command Line',9)
  55.    endif
  56. endif
  57. if not NovCon
  58.    AddChoice('Menu Utilities',8)
  59.    AddChoice('Command Line',9)
  60. endif
  61.  
  62. CornerStretchBox ('Utility Menu',43,6)
  63.  
  64. OnKey Task(1)
  65.   |SelectFormat
  66.   |LastKey = ' '
  67.  
  68. OnKey Task(2)
  69.   ^Dos
  70.  
  71. OnKey Task(3)
  72.   |SelectPrintQueue
  73.   |Dispose Choices
  74.   |LastKey = ' '
  75.  
  76. OnKey Task(4)
  77.   ^NovInfo
  78.  
  79. OnKey Task(5)
  80.   ^NovUser
  81.  
  82. OnKey Task(6)
  83.   ^NovUtils
  84.  
  85. OnKey Task(7)
  86.   ^Maint
  87.  
  88. OnKey Task(8)
  89.   ^MenuUtil
  90.  
  91. OnKey Task(9)
  92.   |if ExistOnPath('DOLIST.EXE') > ''
  93.      DropTo DoList
  94.   |else
  95.   |  Bat 'DropTo ' + ReadEnv('COMSPEC')
  96.   |endif
  97.  
  98. ;=============[ Dos Menu ]============*
  99.  
  100. :Dos
  101.  
  102. AddChoice('Directory Master',1)
  103. AddChoice('Pick Directory',2)
  104. AddChoice('Show Directory',3)
  105. AddChoice('Free Space',4)
  106. AddChoice('Memory Map',5)
  107. AddChoice('Device Drivers',6)
  108.  
  109. CenterStretchBox ('DOS Menu',38,15)
  110.  
  111. OnKey Task(1)
  112.   |if NovConsoleOperator
  113.      DropTo DM3
  114.   |else
  115.      DropTo DMLITE
  116.   |endif
  117.  
  118. OnKey Task(2)
  119.    PD
  120.  
  121. OnKey Task(3)
  122.    D/W
  123.  
  124. OnKey Task(4)
  125.    Free
  126.    Pause
  127.  
  128. OnKey Task(5)
  129.    RamMap
  130.    Pause
  131.  
  132. OnKey Task(6)
  133.    Device
  134.    Pause
  135.  
  136.  
  137. ;=============[ Maintenence Menu ]============*
  138.  
  139. :Maint
  140.  
  141. AddChoice('Tape Backup',1)
  142. AddChoice('Delete *.BAK Files',2)
  143. AddChoice('Delete *.MRX Files',3)
  144.  
  145. CenterStretchBox ('Maintenence Menu',38,15)
  146.  
  147. OnKey Task(1)
  148.    |Error('Put Code for your Tape Backup Software here.')
  149.  
  150. OnKey Task(2)
  151.    Whereis *.BAK /D
  152.  
  153. OnKey Task(3)
  154.    Whereis *.MRX /D
  155.  
  156.  
  157. ;=============[ Menu Utilities Menu ]============*
  158.  
  159. :MenuUtil
  160.  
  161. AddChoice('Edit this Menu',1)
  162. AddChoice('View Include Files',2)
  163. AddChoice('Edit Include Files',3)
  164. AddChoice('View a Menu File',4)
  165. AddChoice('Edit a Menu File',5)
  166. AddChoice('Run a Menu',6)
  167. AddChoice('Load MarxHelp',7)
  168. AddChoice('UnLoad MarxHelp',8)
  169.  
  170. CenterStretchBox ('Menu Utilities',38,15)
  171.  
  172. OnKey Task(1)
  173.    ME %MenuFileName
  174.  
  175. OnKey Task(2)
  176.    |FilePicked = PickAFile('*.INC','Include Files')
  177.    |ViewFile(FilePicked)
  178.  
  179. OnKey Task(3)
  180.    |FilePicked = GetIncludeFile
  181.    |if FilePicked > ''
  182.    |   Bat 'ME ' + FilePicked
  183.    |endif
  184.  
  185. OnKey Task(4)
  186.    |FilePicked = PickAFile ('*.MNU','Menus')
  187.    |ViewFile(FilePicked)
  188.  
  189. OnKey Task(5)
  190.    |FilePicked = PickAFile ('*.MNU','Menus')
  191.    |if FilePicked > ''
  192.    |   Bat 'ME ' + FilePicked
  193.    |endif
  194.  
  195. OnKey Task(6)
  196.    |FilePicked = PickAFile ('*.MNU','Menus')
  197.    |if FilePicked > ''
  198.    |   Bat 'MARX ' + FilePicked
  199.    |endif
  200.  
  201. OnKey Task(7)
  202.    |MxCmd = 'MarxHelp'
  203.  
  204. OnKey Task(8)
  205.    |MxCmd = 'MarxHelp /U'
  206.  
  207.  
  208. ;=============[ Format Menu ]============*
  209.  
  210. Procedure SelectFormat
  211. var Ch Message Option
  212.  
  213.    DrawTheBox(20,12,42,4 + HeightDifference,'Format Floppy Disk Menu')
  214.  
  215.    Writeln ' 1 - Format 360    5 - Format /S 360'
  216.    Writeln ' 2 - Format 1.2M   6 - Format /S 1.2M'
  217.    Writeln ' 3 - Format 720    7 - Format /S 720'
  218.    Write   ' 4 - Format 1.4M   8 - Format /S 1.4M'
  219.  
  220.    Ch = ReadKey
  221.  
  222.    if Ch = '1'
  223.       Message = '360k Format with no System Files.'
  224.       Option = '/4'
  225.  
  226.    elseif Ch = '2'
  227.       Message = '1.2m Format with no System Files.'
  228.       Option = ''
  229.  
  230.    elseif Ch = '3'
  231.       Message = '720k Format with no System Files.'
  232.       Option = '/N:9/T:80'
  233.  
  234.    elseif Ch = '4'
  235.       Message = '1.4m Format with no System Files.'
  236.       Option = '/N:18/T:80'
  237.  
  238.    elseif Ch = '5'
  239.       Message = '360k Format with System Files.'
  240.       Option = '/4/S'
  241.  
  242.    elseif Ch = '6'
  243.       Message = '1.2m Format with System Files.'
  244.       Option = '/S'
  245.  
  246.    elseif Ch = '7'
  247.       Message = '720k Format with System Files.'
  248.       Option = '/N:9/T:80/S'
  249.  
  250.    elseif Ch = '8'
  251.       Message = '1.4m Format with System Files.'
  252.       Option = '/N:18/T:80/S'
  253.  
  254.    else
  255.       Return
  256.  
  257.    endif
  258.  
  259.    if DosVersionString >= '5.00'
  260.       Option = Option + '/U'     ;unconditional
  261.       Option = Option + '/V:DOS' ;automatically adds volume label
  262.    endif
  263.  
  264.    DrawTheBox(46,18,11,2 + HeightDifference,'Drive')
  265.    Writeln '  A:'
  266.    Write   '  B:'
  267.    Ch = ReadKey
  268.    if Ch = Esc then Return
  269.    ExecFormat(Ch,Option,Message)
  270. EndProc
  271.  
  272. ;----- Execute FORMAT in a DOS Window
  273.  
  274. Procedure ExecFormat (Drv,Option,Message)
  275. var FormatProg
  276.  
  277.    FormatProg = ExistOnPath('FORMAT.EXE')
  278.    if FormatProg = '' then FormatProg = ExistOnPath('FORMAT.COM')
  279.    if FormatProg = ''
  280.       Error('FORMAT program not Found!')
  281.       Return
  282.    endif
  283.  
  284.    BoxHeader = ' Formatting Drive ' + Drv + ': ' + Message + ' '
  285.    Shadow Off
  286.    DrawBox 1 4 80 21
  287.    Window  4 5 74 19
  288.    Writeln
  289.    ExecProg (FormatProg + ' ' + Drv + ': ' + Option)
  290.    EraseTopWindow
  291. EndProc
  292.  
  293.  
  294. ;=============[ Novell Utilities Menu ]============*
  295.  
  296. :NovUtils
  297.  
  298. AddChoice('Session Management',1)
  299. AddChoice('File Management',2)
  300. AddChoice('Volume Information',3)
  301. AddChoice('System Configuration',4)
  302. AddChoice('File Server Monitoring',5)
  303. AddChoice('Print Queue Management',6)
  304. AddChoice('Print Job Configurations',7)
  305. AddChoice('Printer Definitions',8)
  306. AddChoice('Folio Help System',9)
  307.  
  308. CenterStretchBox ('Novell Utilities',38,15)
  309.  
  310. OnKey Task(1)
  311.    Session
  312.  
  313. OnKey Task(2)
  314.    Filer
  315.  
  316. OnKey Task(3)
  317.    VolInfo
  318.  
  319. OnKey Task(4)
  320.    Syscon
  321.  
  322. OnKey Task(5)
  323.    FConsole
  324.  
  325. OnKey Task(6)
  326.    PConsole
  327.  
  328. OnKey Task(7)
  329.    PrintCon
  330.  
  331. OnKey Task(8)
  332.    PrintDef
  333.  
  334. OnKey Task(9)
  335.    P:Help
  336.  
  337.  
  338. ;=============[ Novell Information Menu ]============*
  339.  
  340. :NovInfo
  341.  
  342. AddChoice('UserList',1)
  343. AddChoice('Drive Map',2)
  344. AddChoice('Current Dir',3)
  345. AddChoice('Directory Rights',4)
  346. AddChoice('List Servers',5)
  347. AddChoice('Who Am I?',6)
  348. AddChoice('Trustees',7)
  349. AddChoice('System Time',8)
  350. AddChoice('ChkVol',9)
  351. AddChoice('Printer Status',10)
  352.  
  353. CenterStretchBox ('Novell Information',38,15)
  354.  
  355. OnKey Task(1)
  356.    UserList/A
  357.    Echo.
  358.    Pause
  359.  
  360. OnKey Task(2)
  361.    Map
  362.    Echo.
  363.    Pause
  364.  
  365. OnKey Task(3)
  366.    NDir
  367.    Pause
  368.  
  369. OnKey Task(4)
  370.    Rights
  371.    Echo.
  372.    Pause
  373.  
  374. OnKey Task(5)
  375.    SList
  376.    Echo.
  377.    Pause
  378.  
  379. OnKey Task(6)
  380.    WhoAmI/A
  381.    Echo.
  382.    Pause
  383.  
  384. OnKey Task(7)
  385.    TList
  386.    Echo.
  387.    Pause
  388.  
  389. OnKey Task(8)
  390.    SysTime
  391.    Echo.
  392.    Pause
  393.  
  394. OnKey Task(9)
  395.    ChkVol
  396.    Echo.
  397.    Pause
  398.  
  399. OnKey Task(10)
  400.    Capture Show
  401.    Echo.
  402.    Pause
  403.  
  404.  
  405. ;=============[ Novell User Menu ]============*
  406.  
  407. :NovUser
  408.  
  409. AddChoice('Change Password',1)
  410. AddChoice('Block Messages',2)
  411. AddChoice('Receive Messages',3)
  412. AddChoice('End Printer Capture',4)
  413. AddChoice('Send a Message',5)
  414.  
  415. CenterStretchBox ('Novell User Menu',38,15)
  416.  
  417. OnKey Task(1)
  418.    SetPass
  419.  
  420. OnKey Task(2)
  421.    CastOff
  422.  
  423. OnKey Task(3)
  424.    CastOn
  425.  
  426. OnKey Task(4)
  427.    EndCap
  428.  
  429. OnKey Task(5)
  430.    |SendMessage
  431.  
  432. ;----- This routines selects a print queue
  433.  
  434. Procedure SelectPrintQueue
  435. var Queue PrnPort QCmd LocalName
  436.  
  437.    LocalName = '<Local Printer>'
  438.    if NumberOfElements(PrintQueueChoices) = 0
  439.       NovMyPrintQueues(PrintQueueChoices)
  440.       SortArray(PrintQueueChoices)
  441.       AppendArray(PrintQueueChoices,LocalName)
  442.    endif
  443.  
  444.    Choices = PrintQueueChoices
  445.    DrawTheBox(28,11,23,Min(12,NumberOfElements(Choices) + HeightDifference),'Print Queues')
  446.    Queue = PickOne(Choices)
  447.    if LastKey = Esc then Return
  448.    Choices = PortChoices
  449.    CenterStretchBox ('Port',38,20)
  450.    PrnPort = Ord(ReadKey) - 64
  451.    if LastKey = Esc then Return
  452.    EraseTopWindow
  453.  
  454.    if Queue = LocalName
  455.       NovEndCapture (PrnPort)
  456.    else
  457.       NovCaptureQueue (PrnPort) = Queue
  458.       NovCaptureTimeOut (PrnPort) = 5
  459.    endif
  460.  
  461. EndProc
  462.  
  463. ;----- Sends a novell message
  464.  
  465. Procedure SendMessage
  466. var Choice Message
  467.    Choice = PickUser('Send message To')
  468.    if Choice = '' then Return
  469.    Message = ReadTextLine('Message:','',0,21)
  470.    if LastKey = Esc then Return
  471.    ClearScreen
  472.    TextColor MenuHeaderFG MenuBG
  473.    Write ' Sending ... '
  474.    ClearScreenFirst Off
  475.    ExecProg ('Send "' + Message + '" to ' + Choice + '>nul')
  476. EndProc
  477.  
  478. ;----- Select Include File
  479.  
  480. Procedure GetIncludeFile
  481. var IncPath Picked
  482.    IncPath = PathPart(ExistOnPath('CUSTOM.INC'))
  483.    Picked = PickAFile(CleanFileName(IncPath + '\*.INC'),'Include Files')
  484.    if Picked = '' then Return ''
  485.    DelFile(ForceExtension(%MenuFileName,'MRX'))
  486.    Return CleanFileName(IncPath + '\' + Picked)
  487. EndProc
  488.  
  489. ;----- Reads a list of all users on the system
  490.  
  491. Procedure ReadUsers
  492.    if NumberOfElements(AllUsers) > 0 then Return
  493.    NovUsersLoggedIn(AllUsers)
  494.    SortArray(AllUsers)
  495. EndProc
  496.  
  497.  
  498. Procedure PickUser (Message)
  499. var MaxSize
  500.    ReadUsers
  501.    MaxSize = Min(15,NumberOfElements(AllUsers))
  502.    DrawTheBox(46,12 - (MaxSize / 2),20,MaxSize + HeightDifference,Message)
  503.    Return PickOne(AllUsers)
  504. EndProc
  505.  
  506. ;----- Execute a program in a window
  507.  
  508. Procedure ExecProg (Prog)
  509.    TextColor MenuHeaderFG MenuBG
  510.    Cursor Off
  511.    DosWindow
  512.    Execute Prog
  513. EndProc
  514.  
  515.  
  516. Procedure PickAFile (Mask,Message)
  517. var Files Choice MaxSize
  518.    ReadDirectory(Mask,Files)
  519.    MaxSize = Min(15,NumberOfElements(Files))
  520.    if MaxSize = 0
  521.       Error('No Choices!')
  522.       Return ''
  523.    endif
  524.    DrawTheBox(46,12 - (MaxSize / 2),20,MaxSize + HeightDifference,Message)
  525.    Choice = PickOne(Files)
  526.    Return Choice
  527. EndProc
  528.  
  529. ;----- Display Error and Wait for a Key
  530.  
  531. Procedure Error (Err)
  532. var Ch
  533.    BoxHeader = ' Error * Press any Key '
  534.    DrawBox 11 19 Max(27,length(Err) + 4) 3
  535.    Cursor Off
  536.    UseArrows Off
  537.    TextColor MenuHeaderFG MenuBG
  538.    WriteCenter Err
  539.    Write Char(7)
  540.    Ch = ReadKey
  541.    EraseTopWindow
  542. EndProc
  543.